﻿using log4net;
using Mangox.BLL.Applet;
using Mangox.Model.MyBusinessDB;
using Mangox.Model.Stock;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Web.Http;

namespace MGXAPI.Controllers.API
{
    public class MomentsController : ApiController
    {
        static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        private static string className = (new StackTrace()).GetFrame(1).GetMethod().ReflectedType.Name + "/";


        /// <summary>
        /// 下拉分页获取圈子，根据时间优先排序
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public List<MomentsMsgResult> GetMomentsMessList(int index = 1, string openid = null)
        {
            MomentsBLL bll = new MomentsBLL();
            return bll.GetMomentsMessList();
        }

        /// <summary>
        /// 查询某一条圈子，并查询所有评论
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public MomentsMsgComment GetMomentsMsgComment(int id)
        {
            MomentsBLL bll = new MomentsBLL();
            return bll.GetMomentsMsgComment(id);
        }

        [HttpPost]

        public bool AddMomentsMess(T_MomentsMsg model)
        {
            MomentsBLL bll = new MomentsBLL();
            return bll.AddMomentsMess(model);
        }

        [HttpPost]
        public bool DelMomentsMess(T_MomentsMsg model)
        {
            MomentsBLL bll = new MomentsBLL();
            return bll.DelMomentsMess(model);
        }

        /// <summary>
        /// 添加评论
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddComment(T_Comment model)
        {
            return new CommentBLL().AddComment(model);
        }


    }
}
